package top.z.orm.handle.util;

public class ObjectCreatorFactory {

    public static Object create(String s, Class<?> clazz) {
        if (clazz == null) {
            return null;
        }
        if (clazz.equals(String.class)) {
            return ObjectCreator.createString(s);
        }
        s = s.trim();
        if (clazz.equals(int.class) || clazz.equals(Integer.class)) {
            return ObjectCreator.createInt(s);
        } else if (clazz.equals(short.class) || clazz.equals(Short.class)) {
            return ObjectCreator.createShort(s);
        } else if (clazz.equals(byte.class) || clazz.equals(Byte.class)) {
            return ObjectCreator.createByte(s);
        } else if (clazz.equals(double.class) || clazz.equals(Double.class)) {
            return ObjectCreator.createDouble(s);
        } else if (clazz.equals(long.class) || clazz.equals(Long.class)) {
            return ObjectCreator.createLong(s);
        } else if (clazz.equals(boolean.class) || clazz.equals(Boolean.class)) {
            return ObjectCreator.createBoolean(s);
        } else {
            return null;
        }
    }
}